﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ITProject.Domain.Entities;
using ITProject.Repository.Abstract;
using ITProject.Domain;

namespace ITProject.WebUI.Models.Project
{
    public class ProjectUserViewModel
    {
        public string Login { get; set; }
        public string ProjectRole { get; set; }

        public static ProjectUserViewModel[] Convert(User[] users, UserRole[] projectUsersRoles)
        {
            ProjectUserViewModel[] projectUsersVM = new ProjectUserViewModel[users.Length];
            for (int i = 0; i < projectUsersVM.Length; i++)
            {
                projectUsersVM[i] = new ProjectUserViewModel();
                projectUsersVM[i].Login = users[i].Login;
                switch (projectUsersRoles[i])
                {
                    case UserRole.Supervisor:
                        projectUsersVM[i].ProjectRole = "Zarządzający";
                        break;
                    case UserRole.Manager:
                        projectUsersVM[i].ProjectRole = "Lider zespołu";
                        break;
                    case UserRole.User:
                        projectUsersVM[i].ProjectRole = "Uczestnik";
                        break;
                }
            }
            return projectUsersVM;
        }
    }
}